{% extends 'index.html' %}
{% block page-content %}
<div id="page-wrapper">
    <div class="row">
         <div class="col-lg-12">
              <h1 class="page-header"><i class="fa  fa-wrench"></i> 任务添加中心</h1>
         </div>
                <!-- /.col-lg-12 -->
    </div>
	<div class="row">
                <div class="col-lg-12">
                    <div class="panel panel-default">
                        <div class="panel-heading">
                           	 添加任务
                        </div>
                        <div class="panel-body">
                            <div class="row">
                            	<div class="col-lg-3">
                            	</div>
                                <div class="col-lg-6">
                                <legend>计划任务配置 - 必填信息</legend>
                                    <form role="form" method="post" id="addCrontab" class="main form-horizontal" enctype="multipart/form-data" >{% csrf_token %}
										<fieldset>															
											<div class="form-group">
												 <label class="col-sm-2 control-label">分</label>
												 <div class="col-sm-6">
												 	<input type="text" class="form-control" name="cron_minute" placeholder="*/1" value=""  class="input-xlarge" required pattern="^(\*|\*\/[0-5]?[0-9]|[0-5]?[0-9]|)$"  title="正确格式：00-59 or * or */1"  />
												 </div>
											</div>
											
											<div class="form-group">
												 <label class="col-sm-2 control-label">时</label>
												 <div class="col-sm-6">
												 	<input type="text" class="form-control" name="cron_hour" placeholder="0-23" value="" class="input-xlarge" required pattern="^(\*|\*\/[0-2]?[0-9]|[0-2]?[0-9]|)$"  title="正确格式：0-23 or * or */1" />
												 </div>
											</div>	
					
											<div class="form-group">
												 <label class="col-sm-2 control-label">日</label>
												 <div class="col-sm-6">
												 	<input type="text" class="form-control" name="cron_day" placeholder="1-31" value="" class="input-xlarge" required pattern="^(\*|[0-3]?[0-9]|\*\/[0-3]?[0-9])$"  title="正确格式：01 or * or */1"/>
												 </div>
											</div>		
					
											<div class="form-group">
												 <label class="col-sm-2 control-label">月</label>
												 <div class="col-sm-6">
												 	<input type="text" class="form-control" name="cron_month" placeholder="*" value=""  class="input-xlarge"  required  pattern="^(\*|[0-1]?[0-9]|\*\/[0-1]?[0-9])$"  title="正确格式：01 or * or */1"/>
												 </div>
											</div>															
														
											<div class="form-group">
												 <label class="col-sm-2 control-label">周</label>
												 <div class="col-sm-6">
												 	<input type="text" class="form-control" name="cron_week" placeholder="0-7" value="" class="input-xlarge"  required pattern="^(\*|[0-6]||[0-6]\*\/)$"  title="正确格式：01 or * or */1"/>
												 </div>
											</div>	

											<div class="form-group">
												 <label class="col-sm-2 control-label">命令</label>
												 <div class="col-sm-6">
												 	<input type="text" class="form-control" name="cron_command" placeholder="/usr/sbin/ntpdate time.windows.com" value="" class="input-xlarge"  required/>
												 </div>
											</div>
											
											<div class="form-group">
												 <label class="col-sm-2 control-label">上传脚本</label>
												 <div class="col-sm-6">
												 	<input type="file" name="cron_script"  placeholder="上传脚本" value="" />
												 </div>
											</div>		

											<div class="form-group">
												 <label class="col-sm-2 control-label" >脚本路径</label>
												 <div class="col-sm-6">
												 	<input type="text" class="form-control"  name="cron_script_path" placeholder="/usr/local/src/update.sh" value="" class="input-xlarge" pattern="^(/[\w-.\w]+)*$" title="正确格式：/usr/local/src/update.sh"/>
												 </div>
											</div>
																					
											<div class="form-group">
												 <label class="col-sm-2 control-label">用户</label>
												 <div class="col-sm-6">
												 	<input type="text" class="form-control" name="cron_user" placeholder="root" value=""   class="input-xlarge" required pattern="^\w+$" />
												 </div>
											</div>															
												
											<div class="form-group">
												 <label class="col-sm-2 control-label">服务器</label>
												 <div class="col-sm-6">	
					                                 <select class="selectpicker" data-live-search="true"  data-size="5" name="cron_server"  data-width="100%"  required>
					                                 		<option name="cron_server" value="" selected="selected">选择一个主机进行配置</option>
					                                 	{% for ds in serverList %}
					                                 		<option name="cron_server" value="{{ds.id}}">{{ds.ip}} | {{ds.project}} | {{ds.service}}</option>
					                                 	{% endfor %}
					                                 </select>																				 	
												 </div>
											</div>													
												
											<div class="form-group">
												 <label class="col-sm-2 control-label">任务名称</label>
												 <div class="col-sm-6">
												 	<input type="text" class="form-control" name="cron_name" placeholder="计划任务名称" value=""  class="input-xlarge"  required pattern="^[\u4e00-\u9fa5_a-zA-Z0-9]+$"/>
												 </div>
											</div>
											
											<div class="form-group">
												 <label class="col-sm-2 control-label">任务描述</label>
												 <div class="col-sm-6">
												 	<input type="text" class="form-control" name="cron_desc" placeholder="任务描述" value="" class="input-xlarge"/>
												 </div>
											</div>						
											

											<div class="form-group">
												 <label class="col-sm-2 control-label">激活任务</label>
												 <div class="col-sm-6">
												   <select class="form-control" name="cron_status"  >
												   		<option selected="selected" value="0">不激活</option>
														<option  value="1">激活</option>								   		
													</select>							 	
												 </div>
											</div>														
																																											
											
											</fieldset>
											<legend></legend>
											<div class="form-group">
											<label class="col-sm-3 control-label"></label>
											<button type="reset"   class="btn btn-default" >撤销操作</button>
									 		<button type="submit"  class="btn btn-default" >确认提交</button>
									 		</div>
									 		
										</form>	
                                </div>
                                <!-- /.col-lg-6 (nested) -->
                                <!-- /.col-lg-6 (nested) -->
                            </div>
                            <!-- /.row (nested) -->
                        </div>
                        <!-- /.panel-body -->
                    </div>
                    <!-- /.panel -->
                </div>
                <!-- /.col-lg-12 -->
            </div>    
</div>

<script type="text/javascript">
	  {% if errorInfo %}
	  	window.wxc.xcConfirm("{{errorInfo}}", window.wxc.xcConfirm.typeEnum.error);
	  {% endif %}
</script>

{% endblock %}